package Practicas.practica4;


import data.IntegerDataSetGenerator;
import impl.QuickSortWithCut;
import test.BenchMark;

import java.util.ArrayList;
import java.util.Collections;

public class TestCutOff {

    private ArrayList<Integer> list;

    private void testCutOffNanoTime(int valor, int m) {
        list = new ArrayList<Integer>(valor);
        IntegerDataSetGenerator integerDataSetGenerator = new IntegerDataSetGenerator();
        QuickSortWithCut quickSortWithCut = new QuickSortWithCut();
        BenchMark benchMark = new BenchMark();
        quickSortWithCut.addSorterListener(benchMark);
        float random;
        random = 0;

        list = (ArrayList<Integer>) integerDataSetGenerator.createAscending(valor);
        Collections.shuffle(list);
//        System.out.println(list);
        long tiempoRan1 = System.currentTimeMillis();
        quickSortWithCut.sort(integerDataSetGenerator.getComparator(), list, m);
        long tiempoRan2 = System.currentTimeMillis();
        random = tiempoRan2 - tiempoRan1;

        int swapsRamdon = benchMark.getnSwap();
        int comparationsRandom = benchMark.getComparations();
        benchMark.resetAll();





        System.out.println("||  Cant: " + valor + "  ||  Tiempo " + random + "  ||  " + "M: " + m );
//        System.out.println(list);
    }

    public static void main(String[] args) {

        TestCutOff tc = new TestCutOff();
//        tc.testCutOffNanoTime(100,7);
        for (int i = 1000; i < 1000001; i *= 10) {
            for (int m = 4; m < 26; m++) {
                tc.testCutOffNanoTime(i,m);
            }
            System.out.println("*******************************");
            System.out.println("*******************************");
            System.out.println("*******************************");
        }

    }
}
